/******************************************************************************
 * Copyright (C) 2017 Chengdu Dlhd information industry co. LTD.
 * All Rights Reserved.
 * 本软件为成都顶联互动信息产业有限公司开发研制。未经本公司正式书面同意，其他任何个人、团体不得使用、复制、修改或发布本软件.
 *****************************************************************************/
package net.dgg.dggcloud.service.jrcrm.service.cms;

import net.dgg.dggcloud.core.idwork.KeyWorker;
import net.dgg.dggcloud.service.common.base.service.BaseService;
import net.dgg.dggcloud.service.entity.user.User;
import net.dgg.dggcloud.service.jrcrm.dao.cms.BusinessStarAmountDao;
import net.dgg.dggcloud.service.jrcrm.entity.cms.BusinessStarAmount;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @ClassName: BusinessStarAmountService
 * @Description: 星级贷款金额
 * @author 杜倩
 * @date 2018年06月15日10:00:00
 *
 */
@Service
public class BusinessStarAmountService extends BaseService {
    @Autowired
    protected KeyWorker keyWorker;
    @Resource
    private TreeBookService treeBookService;

    @Autowired
    private BusinessStarAmountDao businessStarAmountDao;
    /**
     * 新增或者修改
     */
     public Long addBusinessStarAmount(List<BusinessStarAmount> list, User user){

              for(BusinessStarAmount businessStarAmount:list){
                  if(null == businessStarAmount.getId()){
                      businessStarAmount.setCreateUser(user);
                      businessStarAmount.setId(keyWorker.nextId());
                  }
                  businessStarAmount.setUpdaterUser(user);

                  this.repository.saveOrUpdate(businessStarAmount);
              }

         return  0L;
     }


     public List<Map> getList(){
         return businessStarAmountDao.getStarByCode(null);
     }

     public List<Map> getListByCodeAndAmount(Map map){
         return businessStarAmountDao.getStarByCode(map);
     }



}
